常用的PHP String函数 您所在的位置:网站首页 php string函数 常用的PHP String函数

常用的PHP String函数

2023-07-20 22:54| 来源: 网络整理| 查看: 265

PHP面试题-字符串处理

weixin_39804852: [code=php] function camecase1($str){ $temp_arr = explode('-',$str); // array $temp_str = ''; foreach( $temp_arr as $val) { $temp_str .= ucfirst($val); } return lcfirst($temp_str); } function camecase2($str){ $temp_arr = explode('-',$str); // array for ($i=1; $i < count($temp_arr); $i++) { $temp_arr[$i] = ucfirst($temp_arr[$i]); } return implode('',$temp_arr); } function camecase3($str){ $temp_str = ''; $token = strtok($str,'-'); while ($token !== false) { $temp_str .= ucfirst($token); $token = strtok('-'); } return lcfirst($temp_str); } [/code]



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有